<?php 

function Internet_Secure_user($op, &$edit, &$account, $category = NULL) {
	if ($op == 'insert' ) {
		$path = drupal_get_path('module', 'Internet_Secure') .'/submit.php';
		watchdog('Internet_Secure','Redirecting to '.$path);
		$Internet_Secure_settings = variable_get('Internet_Secure_settings','');
		$query_string='pc='.$edit['Product'];
		$query_string=$query_string.'&uid='.$account->uid;
		$query_string=$query_string.'&GatewayID='.$Internet_Secure_settings['GatewayID'];
		$query_string=$query_string.'&language='.$Internet_Secure_settings['language'];
		$query_string=$query_string.'&Email='.$edit['mail'];
		$query_string=$query_string.'&ReturnURL='.urlencode($Internet_Secure_settings['ReturnURL']);
		$query_string=$query_string.'&xxxTransType='.urlencode($Internet_Secure_settings['xxxTransType']);
		$query_string=$query_string.'&xxxCancelURL='.urlencode($Internet_Secure_settings['xxxCancelURL']);
		_user_mail_notify('register_pending_approval', $account);
		drupal_goto($path,$query_string);	    
	} elseif ($op == 'register' ) {
		$Internet_Secure_settings = variable_get('Internet_Secure_settings','');
		// $Internet_Secure_settings['Products']
		
		$form['isinfo'] = array(
	      '#type' => 'fieldset',
	      '#title' => t('Subscription Information'),
	      '#collapsible' => FALSE,
	      '#weight' => 2
		);
		$form['isinfo']['label'] = array(
		  '#value' => $Internet_Secure_settings['SubscriptionHelp'],
		);

		$products = array();
		$product_lines = explode("\n", $Internet_Secure_settings['Products']); 
		reset($product_lines); 
		foreach($product_lines as $line) 
		{
			$product = explode(";", $line);
			$products[$product[0]]=$product[2]."(".$product[1].")";
		} 

		$form['isinfo']['Product'] = array(
	      '#type' => 'select',
	      '#title' => t('Subscription Plan'),
	      '#default_value' => $edit['Product'],
	      '#required' => 'true',
	      '#options' => $products,
		);
		$form['isinfo']['Footer'] = array(
		  '#value' => $Internet_Secure_settings['Footer'],
		);
		return $form;
	}
}

